﻿using System.Windows.Input;
using Dispatcher.Helpers;

namespace Dispatcher.Views
{
    /// <summary>
    /// Interaction logic for GenericTreeView.xaml
    /// </summary>
    public partial class CommonTreeView
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="CommonTreeView"/> class.
        /// </summary>
        public CommonTreeView()
        {
            InitializeComponent();
            DragDropHelper = new TreeViewDragDropHelper(this);
        }

        /// <summary>
        /// Gets or sets the drag drop helper.
        /// </summary>
        /// <value>
        /// The drag drop helper.
        /// </value>
        private TreeViewDragDropHelper DragDropHelper { get; set; }

        /// <summary>
        /// Handles the MouseMove event of the Tree control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Input.MouseEventArgs"/> instance containing the event data.</param>
        private void Tree_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                DragDropHelper.Drag();
            }
        }
    }
}
